using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_Controls_UserList : IWS.Lib.Utilities.Web.ListControl
{
	protected void Page_Load(object sender, EventArgs e)
	{
		this.lblNotFound.Visible = false;
		this.grdUsers.PageIndexChanged += new EventHandler(grdUsers_PageIndexChanged);

		if (!Page.IsPostBack)
		{
			this.Initialize();
		}
	}

	void grdUsers_PageIndexChanged(object sender, EventArgs e)
	{
		this.LoadUsers(grdUsers.PageIndex);
	}

	protected override void InitializeCustom()
	{
	}

	public void LoadUsers(int page_index)
	{
		this.Initialize(); //always call initialize in case this function is fired before the page_load event. 
		int iTotal = 0;
		System.Web.Security.MembershipUserCollection users = System.Web.Security.Membership.GetAllUsers(page_index,20,out iTotal);
		this.grdUsers.DataSource = users;
		this.grdUsers.DataBind();

		this.lblNotFound.Visible = users.Count == 0;
		this.grdUsers.Visible = users.Count > 0;
	}
}
